home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.tree;
-
- class FixedHeightLayoutCache$FHTreeStateNode extends DefaultMutableTreeNode {
- // $FF: synthetic field
- private final FixedHeightLayoutCache this$0;
- protected boolean isExpanded;
- protected int childIndex;
- protected int row;
- protected TreePath path;
-
- public FixedHeightLayoutCache$FHTreeStateNode(FixedHeightLayoutCache var1, Object var2, int var3, int var4) {
- super(var2);
- this.this$0 = var1;
- this.childIndex = var3;
- this.row = var4;
- }
-
- protected void addNode(FixedHeightLayoutCache$FHTreeStateNode var1) {
- boolean var2 = false;
- int var3 = var1.getChildIndex();
- int var4 = 0;
-
- for(int var5 = ((DefaultMutableTreeNode)this).getChildCount(); var4 < var5; ++var4) {
- if (((FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var4)).getChildIndex() > var3) {
- var2 = true;
- ((DefaultMutableTreeNode)this).insert(var1, var4);
- var4 = var5;
- }
- }
-
- if (!var2) {
- ((DefaultMutableTreeNode)this).add(var1);
- }
-
- }
-
- protected void adjustChildIndexs(int var1, int var2) {
- int var3 = var1;
-
- for(int var4 = ((DefaultMutableTreeNode)this).getChildCount(); var3 < var4; ++var3) {
- FixedHeightLayoutCache$FHTreeStateNode var10000 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var3);
- var10000.childIndex += var2;
- }
-
- }
-
- protected void adjustRowBy(int var1) {
- this.row += var1;
- if (this.isExpanded) {
- for(int var2 = ((DefaultMutableTreeNode)this).getChildCount() - 1; var2 >= 0; --var2) {
- ((FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var2)).adjustRowBy(var1);
- }
- }
-
- }
-
- protected void adjustRowBy(int var1, int var2) {
- if (this.isExpanded) {
- for(int var3 = ((DefaultMutableTreeNode)this).getChildCount() - 1; var3 >= var2; --var3) {
- ((FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var3)).adjustRowBy(var1);
- }
- }
-
- FixedHeightLayoutCache$FHTreeStateNode var4 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getParent();
- if (var4 != null) {
- var4.adjustRowBy(var1, ((DefaultMutableTreeNode)var4).getIndex(this) + 1);
- }
-
- }
-
- protected void childInsertedAtModelIndex(int var1, boolean var2) {
- int var4 = ((DefaultMutableTreeNode)this).getChildCount();
-
- for(int var5 = 0; var5 < var4; ++var5) {
- FixedHeightLayoutCache$FHTreeStateNode var3 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var5);
- if (var3.childIndex >= var1) {
- if (var2) {
- this.adjustRowBy(1, var5);
- FixedHeightLayoutCache.access$3(this.this$0, 1);
- }
-
- while(var5 < var4) {
- ++((FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var5)).childIndex;
- ++var5;
- }
-
- return;
- }
- }
-
- if (var2) {
- this.adjustRowBy(1, var4);
- FixedHeightLayoutCache.access$3(this.this$0, 1);
- }
-
- }
-
- protected void collapse(boolean var1) {
- if (this.isExpanded) {
- TreePath[] var2;
- if (this.this$0.treeSelectionModel != null) {
- var2 = this.this$0.treeSelectionModel.getSelectionPaths();
- } else {
- var2 = null;
- }
-
- if (this.isVisible() && var1) {
- int var3 = this.getTotalChildCount();
- this.isExpanded = false;
- FixedHeightLayoutCache.access$3(this.this$0, -var3);
- this.adjustRowBy(-var3, 0);
- } else {
- this.isExpanded = false;
- }
-
- if (var2 != null) {
- boolean var6 = false;
- TreePath var4 = this.getTreePath();
-
- for(int var5 = var2.length - 1; var5 >= 0; --var5) {
- if (var2[var5] != null && var4.isDescendant(var2[var5]) && !var4.equals(var2[var5])) {
- var6 = true;
- } else {
- var2[var5] = null;
- }
- }
-
- if (var6) {
- this.this$0.treeSelectionModel.removeSelectionPaths(var2);
- }
- }
-
- if (var1 && this.isVisible() && this.this$0.treeSelectionModel != null) {
- this.this$0.treeSelectionModel.resetRowSelection();
- }
- }
-
- }
-
- protected FixedHeightLayoutCache$FHTreeStateNode createChildFor(Object var1) {
- int var2 = this.this$0.treeModel.getIndexOfChild(((DefaultMutableTreeNode)this).getUserObject(), var1);
- if (var2 < 0) {
- return null;
- } else {
- FixedHeightLayoutCache$FHTreeStateNode var4 = FixedHeightLayoutCache.access$2(this.this$0, var1, var2);
- int var5;
- if (this.isVisible()) {
- var5 = this.getRowToModelIndex(var2);
- } else {
- var5 = -1;
- }
-
- var4.row = var5;
- int var6 = 0;
-
- for(int var7 = ((DefaultMutableTreeNode)this).getChildCount(); var6 < var7; ++var6) {
- FixedHeightLayoutCache$FHTreeStateNode var3 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var6);
- if (var3.childIndex > var2) {
- ((DefaultMutableTreeNode)this).insert(var4, var6);
- return var4;
- }
- }
-
- ((DefaultMutableTreeNode)this).add(var4);
- return var4;
- }
- }
-
- protected void didAdjustTree() {
- }
-
- protected void didExpand() {
- int var1 = this.setRowAndChildren(this.row);
- FixedHeightLayoutCache$FHTreeStateNode var2 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getParent();
- int var3 = var1 - this.row - 1;
- if (var2 != null) {
- var2.adjustRowBy(var3, ((DefaultMutableTreeNode)var2).getIndex(this) + 1);
- }
-
- FixedHeightLayoutCache.access$3(this.this$0, var3);
- }
-
- protected void expand() {
- if (!this.isExpanded) {
- boolean var1 = this.isVisible();
- this.isExpanded = true;
- if (var1) {
- this.didExpand();
- }
-
- if (var1 && this.this$0.treeSelectionModel != null) {
- this.this$0.treeSelectionModel.resetRowSelection();
- }
- }
-
- }
-
- protected void expandParentAndReceiver() {
- FixedHeightLayoutCache$FHTreeStateNode var1 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getParent();
- if (var1 != null) {
- var1.expandParentAndReceiver();
- }
-
- this.expand();
- }
-
- public FixedHeightLayoutCache$FHTreeStateNode getChildAtModelIndex(int var1) {
- for(int var2 = ((DefaultMutableTreeNode)this).getChildCount() - 1; var2 >= 0; --var2) {
- if (((FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var2)).childIndex == var1) {
- return (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var2);
- }
- }
-
- return null;
- }
-
- public int getChildIndex() {
- return this.childIndex;
- }
-
- protected int getCountTo(int var1) {
- int var3 = var1 + 1;
- int var4 = 0;
-
- for(int var5 = ((DefaultMutableTreeNode)this).getChildCount(); var4 < var5; ++var4) {
- FixedHeightLayoutCache$FHTreeStateNode var2 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var4);
- if (var2.childIndex >= var1) {
- var4 = var5;
- } else {
- var3 += var2.getTotalChildCount();
- }
- }
-
- if (super.parent != null) {
- return var3 + ((FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getParent()).getCountTo(this.childIndex);
- } else if (!this.this$0.isRootVisible()) {
- return var3 - 1;
- } else {
- return var3;
- }
- }
-
- protected int getNumExpandedChildrenTo(int var1) {
- int var3 = var1;
- int var4 = 0;
-
- for(int var5 = ((DefaultMutableTreeNode)this).getChildCount(); var4 < var5; ++var4) {
- FixedHeightLayoutCache$FHTreeStateNode var2 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var4);
- if (var2.childIndex >= var1) {
- return var3;
- }
-
- var3 += var2.getTotalChildCount();
- }
-
- return var3;
- }
-
- protected boolean getPathForRow(int var1, int var2, FixedHeightLayoutCache.SearchInfo var3) {
- if (this.row == var1) {
- var3.node = this;
- var3.isNodeParentNode = false;
- var3.childIndex = this.childIndex;
- return true;
- } else {
- FixedHeightLayoutCache$FHTreeStateNode var5 = null;
- int var6 = 0;
-
- for(int var7 = ((DefaultMutableTreeNode)this).getChildCount(); var6 < var7; ++var6) {
- FixedHeightLayoutCache$FHTreeStateNode var4 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var6);
- if (var4.row > var1) {
- if (var6 == 0) {
- var3.node = this;
- var3.isNodeParentNode = true;
- var3.childIndex = var1 - this.row - 1;
- return true;
- }
-
- int var8 = 1 + var4.row - (var4.childIndex - var5.childIndex);
- if (var1 < var8) {
- return var5.getPathForRow(var1, var8, var3);
- }
-
- var3.node = this;
- var3.isNodeParentNode = true;
- var3.childIndex = var1 - var8 + var5.childIndex + 1;
- return true;
- }
-
- var5 = var4;
- }
-
- int var10 = this.this$0.treeModel.getChildCount(((DefaultMutableTreeNode)this).getUserObject());
- if (var5 != null) {
- int var11 = var2 - (var10 - var5.childIndex) + 1;
- if (var1 < var11) {
- return var5.getPathForRow(var1, var11, var3);
- } else {
- var3.node = this;
- var3.isNodeParentNode = true;
- var3.childIndex = var1 - var11 + var5.childIndex + 1;
- return true;
- }
- } else {
- int var9 = var1 - this.row - 1;
- if (var9 >= var10) {
- return false;
- } else {
- var3.node = this;
- var3.isNodeParentNode = true;
- var3.childIndex = var9;
- return true;
- }
- }
- }
- }
-
- public int getRow() {
- return this.row;
- }
-
- public int getRowToModelIndex(int var1) {
- int var3 = this.getRow() + 1;
- int var5 = 0;
-
- for(int var6 = ((DefaultMutableTreeNode)this).getChildCount(); var5 < var6; ++var5) {
- FixedHeightLayoutCache$FHTreeStateNode var2 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var5);
- if (var2.childIndex >= var1) {
- if (var2.childIndex == var1) {
- return var2.row;
- }
-
- if (var5 == 0) {
- return this.getRow() + 1 + var1;
- }
-
- return var2.row - (var2.childIndex - var1);
- }
- }
-
- return this.getRow() + 1 + this.getTotalChildCount() - (this.this$0.treeModel.getChildCount(((DefaultMutableTreeNode)this).getUserObject()) - var1);
- }
-
- public int getTotalChildCount() {
- if (!this.isExpanded()) {
- return 0;
- } else {
- FixedHeightLayoutCache$FHTreeStateNode var1 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getParent();
- int var2;
- if (var1 != null && (var2 = ((DefaultMutableTreeNode)var1).getIndex(this)) + 1 < ((DefaultMutableTreeNode)var1).getChildCount()) {
- FixedHeightLayoutCache$FHTreeStateNode var5 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)var1).getChildAt(var2 + 1);
- return var5.row - this.row - (var5.childIndex - this.childIndex);
- } else {
- int var3 = this.this$0.getModel().getChildCount(((DefaultMutableTreeNode)this).getUserObject());
-
- for(int var4 = ((DefaultMutableTreeNode)this).getChildCount() - 1; var4 >= 0; --var4) {
- var3 += ((FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var4)).getTotalChildCount();
- }
-
- return var3;
- }
- }
- }
-
- public TreePath getTreePath() {
- return this.path;
- }
-
- public int getVisibleLevel() {
- return this.this$0.isRootVisible() ? ((DefaultMutableTreeNode)this).getLevel() : ((DefaultMutableTreeNode)this).getLevel() - 1;
- }
-
- public boolean isExpanded() {
- return this.isExpanded;
- }
-
- public boolean isVisible() {
- FixedHeightLayoutCache$FHTreeStateNode var1 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getParent();
- if (var1 == null) {
- return true;
- } else {
- return var1.isExpanded() && var1.isVisible();
- }
- }
-
- protected void makeVisible() {
- FixedHeightLayoutCache$FHTreeStateNode var1 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getParent();
- if (var1 != null) {
- var1.expandParentAndReceiver();
- }
-
- }
-
- public void remove(int var1) {
- FixedHeightLayoutCache$FHTreeStateNode var2 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var1);
- var2.removeFromMapping();
- super.remove(var1);
- }
-
- protected void removeChildAtModelIndex(int var1, boolean var2) {
- FixedHeightLayoutCache$FHTreeStateNode var3 = this.getChildAtModelIndex(var1);
- if (var3 != null) {
- int var4 = var3.getRow();
- int var5 = ((DefaultMutableTreeNode)this).getIndex(var3);
- var3.collapse(false);
- this.remove(var5);
- this.adjustChildIndexs(var5, -1);
- if (var2) {
- this.resetChildrenRowsFrom(var4, var5, var1);
- }
- } else {
- int var7 = ((DefaultMutableTreeNode)this).getChildCount();
-
- for(int var6 = 0; var6 < var7; ++var6) {
- FixedHeightLayoutCache$FHTreeStateNode var8 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var6);
- if (var8.childIndex >= var1) {
- if (var2) {
- this.adjustRowBy(-1, var6);
- FixedHeightLayoutCache.access$3(this.this$0, -1);
- }
-
- while(var6 < var7) {
- --((FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var6)).childIndex;
- ++var6;
- }
-
- return;
- }
- }
-
- if (var2) {
- this.adjustRowBy(-1, var7);
- FixedHeightLayoutCache.access$3(this.this$0, -1);
- }
- }
-
- }
-
- protected void removeFromMapping() {
- if (this.path != null) {
- FixedHeightLayoutCache.access$1(this.this$0, this);
-
- for(int var1 = ((DefaultMutableTreeNode)this).getChildCount() - 1; var1 >= 0; --var1) {
- ((FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var1)).removeFromMapping();
- }
- }
-
- }
-
- protected void resetChildrenPaths(TreePath var1) {
- FixedHeightLayoutCache.access$1(this.this$0, this);
- if (var1 == null) {
- this.path = new TreePath(((DefaultMutableTreeNode)this).getUserObject());
- } else {
- this.path = var1.pathByAddingChild(((DefaultMutableTreeNode)this).getUserObject());
- }
-
- FixedHeightLayoutCache.access$0(this.this$0, this);
-
- for(int var2 = ((DefaultMutableTreeNode)this).getChildCount() - 1; var2 >= 0; --var2) {
- ((FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var2)).resetChildrenPaths(this.path);
- }
-
- }
-
- protected void resetChildrenRowsFrom(int var1, int var2, int var3) {
- int var9 = var1;
- int var5 = var3;
- int var7 = ((DefaultMutableTreeNode)this).getChildCount();
-
- for(int var8 = var2; var8 < var7; ++var8) {
- FixedHeightLayoutCache$FHTreeStateNode var6 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var8);
- var9 += var6.childIndex - var5;
- var5 = var6.childIndex + 1;
- if (var6.isExpanded) {
- var9 = var6.setRowAndChildren(var9);
- } else {
- var6.row = var9++;
- }
- }
-
- var9 += this.this$0.treeModel.getChildCount(((DefaultMutableTreeNode)this).getUserObject()) - var5;
- FixedHeightLayoutCache$FHTreeStateNode var11 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getParent();
- if (var11 != null) {
- var11.resetChildrenRowsFrom(var9, ((DefaultMutableTreeNode)var11).getIndex(this) + 1, this.childIndex + 1);
- } else {
- FixedHeightLayoutCache.access$5(this.this$0, var9);
- }
-
- }
-
- public void setParent(MutableTreeNode var1) {
- super.setParent(var1);
- if (var1 != null) {
- this.path = ((FixedHeightLayoutCache$FHTreeStateNode)var1).getTreePath().pathByAddingChild(((DefaultMutableTreeNode)this).getUserObject());
- FixedHeightLayoutCache.access$0(this.this$0, this);
- }
-
- }
-
- protected int setRowAndChildren(int var1) {
- this.row = var1;
- if (!this.isExpanded()) {
- return this.row + 1;
- } else {
- int var7 = this.row + 1;
- int var3 = 0;
- int var5 = ((DefaultMutableTreeNode)this).getChildCount();
-
- for(int var6 = 0; var6 < var5; ++var6) {
- FixedHeightLayoutCache$FHTreeStateNode var4 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getChildAt(var6);
- var7 += var4.childIndex - var3;
- var3 = var4.childIndex + 1;
- if (var4.isExpanded) {
- var7 = var4.setRowAndChildren(var7);
- } else {
- var4.row = var7++;
- }
- }
-
- return var7 + this.this$0.treeModel.getChildCount(((DefaultMutableTreeNode)this).getUserObject()) - var3;
- }
- }
-
- public void setUserObject(Object var1) {
- super.setUserObject(var1);
- if (this.path != null) {
- FixedHeightLayoutCache$FHTreeStateNode var2 = (FixedHeightLayoutCache$FHTreeStateNode)((DefaultMutableTreeNode)this).getParent();
- if (var2 != null) {
- this.resetChildrenPaths(var2.getTreePath());
- } else {
- this.resetChildrenPaths((TreePath)null);
- }
- }
-
- }
- }
-